package main;

import game.components.AppUtilities;

import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

import app.tcp.PlayerClient;
import app.tcp.PlayerSever;
import app.ui.MainFrame;

public class CaroGameStart {

	public static void main(String[] args) {
		try {
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		} catch (InstantiationException e) {
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		} catch (UnsupportedLookAndFeelException e) {
			e.printStackTrace();
		}

		AppUtilities appUtilities = new AppUtilities();
		MainFrame mainFrame = new MainFrame(appUtilities);

		mainFrame.setVisible(true);

		// rmi
		// GameAction gameAction = (GameAction) appUtilities.getGameAction();

		// tcp/ip
		if (args[0].equals("server")) {
			PlayerSever playerSever = new PlayerSever(mainFrame);
			playerSever.createServer();
		} else if (args[0].equals("client")) {
			PlayerClient playerClient = new PlayerClient(mainFrame);
			playerClient.connectToServer();
		}
	}
}
